﻿using System.Collections.Generic;
using com.guojin.core.io;
using com.guojin.core.io.message;
using com.guojin.mj.net.message.login;

namespace com.guojin.mj.net.message.game
{
    public class GameRoomInfoRet : Message
    {
        public static int TYPE = 12;
        public static int ID = 7;

        public int roomType { get; set; }
        public string roomID { get; set; }
        public int currentUserNum { get; set; }
        public int maxUser { get; set; }
        public int currentChapterNum { get; set; }
        public int maxChapterNum { get; set; }
        public int state { get; set; }
        public int trusteeshipTime { get; set; }
        public List<GameUserInfoRet> gameUser { get; set; }
        public ChapterInfoRet chapter { get; set; }
        public List<OptionEntry> options { get; set; }

        public void decode(Input _in)
        {
            roomType = _in.readInt();
            roomID = _in.readString();
            currentUserNum = _in.readInt();
            maxUser = _in.readInt();
            currentChapterNum = _in.readInt();
            maxChapterNum = _in.readInt();
            state = _in.readInt();
            trusteeshipTime = _in.readInt();
            gameUser = new List<GameUserInfoRet>();
            gameUser = _in.readList<GameUserInfoRet>(_in);
            chapter = new ChapterInfoRet();
            chapter.decode(_in);
            options = new List<OptionEntry>();
            int len = _in.readInt();
            if (len > 0)
            {
                for (int i = 0; i < len ; i++)
                {
                    var op = new OptionEntry();
                    op.decode(_in);
                    options.Add(op);
                }
            }
        }

        public void encode(Output _out)
        {
        }

        public int getMessageType()
        {
            return TYPE;
        }

        public int getMessageId()
        {
            return ID;
        }

        public string toString()
        {
            return  string.Format("GameRoomInfoRet[roomType={0}, roomIDTex={1},  currentUserNum={2}, maxUser={3},  currentChapterNum={4}, " +
                                  "maxChapterNum= {5}, state={6}], truesteeshipTime= {7}",roomType,roomID,currentUserNum,maxUser,currentChapterNum,maxChapterNum,state,trusteeshipTime);
        }
    }
}